<?php
require "momo.php";
/**************************************************
                          模板应用转发程序
***************************************************/
//获取数据
  $app=$_GET["app"];//APP判断2
  $type=$_GET["type"];//类型
  $user=$_M['USER']['user'];//获取用户名
  $name=$_M['USER']['name'];//获取昵称

//转发规则处理
if($app=="index"){
   /*****前台所有转发处理*****/

   if($type=="index"){
     /******加载首页模板******/
     $title=$index."-®MoFeng";//标题
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/bbs-index.mo";
     include "templades/".$template."/footer.mo";
    }
   else if($type=="login"){
     if($user==""){
     /******加载登录模板******/
     $title=$login;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/login.mo";
     include "templades/".$template."/footer.mo";
     }else{
       Header('Location:forward.php?app=index&type=user');
      }
    }
   else if($type=="reg"){
     if($user==""){
     /******加载注册模板******/
     $title=$reg;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/reg.mo";
     include "templades/".$template."/footer.mo";
     }else{
       Header('Location:forward.php?app=index&type=user');
      }
    }
    else if($type=="look"){
     /******加载查看页面模板******/
     $title=$look;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/look.mo";
     //include "templades/".$template."/footer.mo";
   }
   else if($type=="bbs"){
     /******加载版块发帖模板******/
     $title=$bbs;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/bbs.mo";
     include "templades/".$template."/footer.mo";
    }
   else if($type=="bbs-index"){
     /******加载版块模板******/
     $title=$bbs_index;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
    include "templades/".$template."/index2.mo";
     include "templades/".$template."/footer.mo";
    }
   else if($type=="bbs-look"){
     /******加载文章模板******/
     $title=$bbs_look;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/bbs-look.mo";
     include "templades/".$template."/footer.mo";
    }
    else if($type=="bbs-published"){
     if($user!=""){
     /******加载发帖模板******/
     $title=$bbs_published;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/bbs-published.mo";
     include "templades/".$template."/footer.mo";
     }else{
       Header('Location:forward.php?app=index&type=login');
      }
   }
    else if($type=="user"){
     if($user!=""){
     /******加载用户中心模板******/
     $title=$USER."-".$name;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/user.mo";
     include "templades/".$template."/footer.mo";
     }else{
       Header('Location:forward.php?app=index&type=login');
      }
   }
    else if($type=="search"){
     /******加载搜索模板******/
     $title="论坛搜索";
     include "templades/".$template."/head.mo";
     include "templades/".$template."/Nav.mo";
     include "templades/".$template."/search.mo";
     include "templades/".$template."/footer.mo";
   }
    else if($type=="exit"){
    unset($_SESSION['key']);
    Header('Location:index.php');
   }
    else{
     /******加载404模板******/
     $title=$error;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/menu.mo";
     include "templades/".$template."/error.mo";
     include "templades/".$template."/footer.mo";
}


}
   /*****后台所有转发处理*****/
else if($app=="admin"){

   if($type=="index"){
     /******加载后台首页模板******/
     $title=$admin."-http://mfo95.com/";//标题
     include "templades/Admin/head.mo";
     include "templades/Admin/index.mo";
     include "templades/Admin/footer.mo";
    }
else{
     /******加载404模板******/
     $title=$error;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/error.mo";
     include "templades/".$template."/footer.mo";
}
   

}
else{
     /******加载404模板******/
     $title=$error;
     include "templades/".$template."/head.mo";
     include "templades/".$template."/error.mo";
     include "templades/".$template."/footer.mo";
}
?>